<?php

use yii\db\Migration;

/**
 * Handles the creation of table `send_msg`.
 */
class m180417_075223_create_send_msg_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('send_msg', [
            'id' => $this->primaryKey(),
            'mobile' => $this->string()->notNull()->comment('接收人'),
            'title' => $this->string()->notNull()->comment('标题'),
            'content' => $this->text()->notNull()->comment('内容'),
            'type' => $this->smallInteger()->notNull()->defaultValue(1)->comment('类型'),//1短信、2邮件
            'created_at' => $this->timestamp()->notNull()->comment('发送时间'),
            'user_id' => $this->integer()->notNull()->comment('发送人'),
            'status' => $this->smallInteger()->notNull()->comment('状态')->defaultValue(1),//1成功0失败
            'result' => $this->text()->notNull()->comment('失败原因'),//
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('send_msg');
    }
}
